package modelLayer;

import java.util.ArrayList;
import java.util.List;

public class Class {
	
	private String className;
	private String classOf;
	private Schedule schedule;
	private Teacher classTeacher;
	private List<TeachingBlock> tbList;
	
	
	public Class(String className, String classOf) {
		
		this.className = className;
		this.classOf = classOf;
		this.tbList = new ArrayList<TeachingBlock>();
		
	}
	
	public Class(String className, String classOf, Teacher classTeacher) {
		
		this.className = className;
		this.classOf = classOf;
		this.classTeacher = classTeacher;
	}
	
	public Class() {
	
	}
	
	public void addTeachingBlock(TeachingBlock tb){
		if (tb != null && !tbList.contains(tb)){
			tbList.add(tb);
		}
	}
	
	public TeachingBlock findTeachingBlock(String ID){
		TeachingBlock tb = null;
		boolean found = false;
		for(int i = 0; !found && i < tbList.size(); i++){
			if(tbList.get(i).getID().equals(ID)){
				tb = tbList.get(i);
				found = true;
			}
		}
		return tb;
	}
	
	
	public String getClassName() {
		return className;
	}



	public void setClassName(String className) {
		this.className = className;
	}



	public String getClassOf() {
		return classOf;
	}



	public void setClassOf(String classOf) {
		this.classOf = classOf;
	}



	public Teacher getClassTeacher() {
		return classTeacher;
	}

	public void setClassTeacher(Teacher classTeacher) {
		this.classTeacher = classTeacher;
	}

	public Schedule getSchedule() {
		return schedule;
	}



	public void setSchedule(Schedule schedule) {
		this.schedule = schedule;
	}



	
	
	/**
	 * @return the tbList
	 */
	public List<TeachingBlock> getTbList() {
		return tbList;
	}

	/**
	 * @param tbList the tbList to set
	 */
	public void setTbList(List<TeachingBlock> tbList) {
		this.tbList = tbList;
	}
	
	public String toString() {
		
		return String.format("%s\n%s", className, classOf);

	}
	
	
	
	

	

}
